package com.itboye.hutouben.util;


import com.itboye.hutouben.base.MyApplcation;
import com.itboye.hutouben.volley.ResultEntity;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 本地保存的数据
 */
public class IsUtilUid {
    /**
     * 返回值code的判断（在update里面用）
     * @param entity
     */
    public static void tianjia(ResultEntity entity){
        if (!entity.getCode().equals("0")) {
            if(entity.getCode().equals("1111")){
                ByAlert.alert(entity.getMsg());
                return;
            }
            ByAlert.alert(entity.getMsg());
            return;
        }
    }
    /**
     * id
     * @return
     */
    public static String isUid() {
        String uid = (String) SPUtils.get(MyApplcation.ctx, null, Const.ID, "");
        return uid;
    }

    /**
     * 会话
     * @return
     */
    public static String sId() {
        String sid = (String) SPUtils.get(MyApplcation.ctx, null, Const.S_ID, "");
        return sid;
    }

    /**
     * 头像ID
     *
     * @return
     */
    public static String isHead() {
        String uid = (String) SPUtils.get(MyApplcation.ctx, null, Const.HEAD, "");
        return uid;
    }

    /**
     * 登录时的 密码
     *
     * @returnisGoup
     */
    public static String isPwd() {
        String pwd = (String) SPUtils.get(MyApplcation.ctx, null, Const.PaySecret, "");
        return pwd;
    }


    /**
     * 用户组
     *
     * @return
     */
    public static String isGoup() {
        String pwd = (String) SPUtils.get(MyApplcation.ctx, null, Const.RELE, "");
        return pwd;
    }

    public static boolean isMobileNO(String mobiles) {

        Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");

        Matcher m = p.matcher(mobiles);
        return m.matches();
    }


}
